from  selenium.webdriver.common.by import By
from  base.base_page import BasePage

class HomePage(BasePage):
    def __init__(self):
        super().__init__()
        # 登陆
        self.login_button = (By.XPATH,
        "//*[@id='app']/header/div/div[2]/div[1]")
        #登录框内容
        self.user = (By.XPATH,
                     "//*[@id='app']/div[3]/div/div[2]/div/div/div[1]/div[1]/input")
        self.pwd = (By.XPATH,
                    "//*[@id='app']/div[3]/div/div[2]/div/div/div[1]/div[2]/input")
        self.login_button1 = (By.XPATH,
                             "//*[@id='app']/div[3]/div/div[2]/div/div/div[1]/button")

    # 点击请登陆
    def home_to_login(self):
        self.find_el(self.login_button).click()

    #定位登陆按钮
    def login(self, user, pwd):
        self.input_text(self.find_el(self.user),user)
        self.input_text(self.find_el(self.pwd),pwd)
        self.find_el(self.login_button1).click()